package cn.xm.lingshi.controller;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.xm.lingshi.pojo.Flavour;
import cn.xm.lingshi.pojo.Shop;
import cn.xm.lingshi.service.FlavourService;
import cn.xm.lingshi.service.ShopService;
import cn.xm.lingshi.service.impl.FlavourServiceImpl;
import cn.xm.lingshi.service.impl.ShopServiceImpl;

import com.alibaba.fastjson.JSON;
/**
 * 所有口味
 * @author 魏魁
 *
 */
public class FlavourServlet extends HttpServlet {

	
	private static final long serialVersionUID = 1L;

	
	public void destroy() {
		super.destroy(); 
		
	}

	
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		response.setContentType("text/html;charset=UTF-8");
		PrintWriter out = response.getWriter();
		// 接收请求数据
		request.setCharacterEncoding("UTF-8");
		FlavourService service=new FlavourServiceImpl();
		List<Flavour > list=service.requstflav();
		//响应JSON格式的数据
		out.print(JSON.toJSONString(list));
		out.flush();
		out.close();
	}

	
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		this.doGet(request, response);
	}

	
	public void init() throws ServletException {
		
	}

}
